package projectmanagement.managementtool.ManagementToolServices;

import projectmanagement.models.Iteration;
import projectmanagement.models.Project;
import projectmanagement.models.Task;
import projectmanagement.models.User;
import projectmanagement.models.Meeting;

import java.util.Calendar;
import java.util.Collection;
import java.util.List;

public interface ManagementTool {
    /**
     * @deprecated
     * Searches for project by ID, creates and returns iteration.
     * @return iteration instance if iteration was created, null if validation failed or project not found
     */
    public Iteration createIteration(int projectId, Calendar startDate,
                                     Calendar finishDate, String description);


    /**
     * Searches for project by ID and creates iterations for it.
     * @param projectId id of the project where new iterations should be put
     * @param duration duration of each iteration in days
     * @return number of iterations created, -1 indicates that project cannot be found
     */
    public int scheduleIterations(int projectId, int duration);

    /**
     * Searches and returns iteration by id
     * @return iteration if search was successful, null otherwise
     */
    public Iteration getIterationById(int projectId, int iterationId);

    /**
     * Searches for project and returns list of its iterations
     * @param projectId id of project
     * @return list of iterations if search was successful, null otherwise
     */
    public Collection<Iteration> getListOfIterations(int projectId);

    /**
     * Exam is ID of iteration that user entered valid.
     *
     * @param iterationId ID of iteration entered by user.
     * @param projectId id of project containing the iteration
     * */
    boolean isIterationIdValid(int projectId, int iterationId);

    /**
     * Searches for meeting by id
     * @param projectId project id
     * @param meetingId meeting id
     * @return meeting if search was successful, null otherwise
     */
    public Meeting getMeetingById(int projectId, int meetingId);

    /**
     * Used for create new project from scratch.
     * @param projectName
     * @param projectStartDate
     * @param projectFinishDate
     * @param projectDescription
     * @return
     */
    public Project createProject(String projectName, Calendar projectStartDate, Calendar projectFinishDate, String projectDescription);
    
    /**
     * Used for update the existing priject.
     * @param project
     */
    public void updateProject(Project project);
    
    /**
     * Used for delete the existing project.
     * @param project
     */
    public void deleteProject(Project project);
    
    public Collection<Project> getProjectsList();

    public User createUser(String name, int age, String position, String technologies);

    public Collection<User> getUsersList();
    
    public Project getProjectById(int projectId);
    
    public Task createTask(int estimation,String description);

    public List<Task> getListOfTasks(int projectId);

    public void assignTaskToIteration(Project p, int taskId, int iterationId);

    public Task getTaskById(int projectId,int taskId);
    
    public User getUserById(int userId);
    
    public boolean assignUserToTask(int projectId, int taskId,User u);
    public void assignTaskToUser(int taskId, int projectId, int userId);

    public void assignUserToProject(int userId, int projectId);

    public Project getProjectByName(String name);
    
    public boolean isProjectNameValid(String name);
    
    public int getIdByProjectName(String name);

    User getUserByName(String name);

    boolean isTaskIdValid(int projectId,int taskId);

    public boolean addTask(int projectId, Task task);
}